<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        p {
            font-size: 25px;
            font-weight: bold;
        }

        div {
            width: 800px;
            height: 30px;
            background: #dddddd;
        }

        span {
            width: 10px;
            height: 30px;
            background: #4eaf52;
            display: inline-block;
        }
    </style>
</head>
<body>
<p>JavaScript 进度条</p>
<div><span id="a"></span></div>
<input id="btn" type="button" value="点我" onclick="f()">
<script>
    var a = 50;
    function f() {
        a+=50;
        document.getElementById('a').style.width = a+50+"px";
        setInterval("f()",500);
    }
</script>
</body>
</html>